#include <cstdio>
#include <cstring>
#include <vector>

/**
 * Luogu P1118: Backward Problem of Number Summation
 */

int N;
int coeff[12], seq[12];
bool chosen[13];

bool search(int idx, int remain) {
    // Prune impossible branches
    if (remain < 0) return false;

    // Permutation is formed
    if (idx == N) {
        if (remain != 0) return false;
        for (int i = 0; i < N; i++) {
            if (i != 0) printf(" ");
            printf("%d", seq[i]);
        }
        printf("\n");
        return true;
    }

    // Choose next number
    for (int k = 1; k <= N; k++) {
        if (chosen[k]) continue;
        chosen[k] = true;
        seq[idx] = k;
        if (search(idx + 1, remain - coeff[idx] * k)) return true;
        chosen[k] = false;
    }

    return false;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    // Input
    int sum;
    scanf("%d %d", &N, &sum);

    // Compute binomial coefficients
    for (int i = 0; i < N; i++) coeff[i] = 1;
    for (int n = 2; n < N; n++)
        for (int k = n - 1; k > 0; k--) coeff[k] += coeff[k - 1];

    // DFS permutations
    memset(chosen + 1, 0, N);
    search(0, sum);

    return 0;
}
